package com.iakuil.app.common.core.exception;

import com.iakuil.app.common.core.enums.Results;

/**
 * 业务异常
 *
 * <p>自定义的业务异常类，通常携带用户友好的错误码信息。
 *
 * @author Kai
 */
public class BusinessException extends BaseException {

    public BusinessException() {
        // 默认错误码-1
        super(Results.FAIL.getCode(), Results.FAIL.getMessage());
    }

    public BusinessException(int code) {
        super(code, Results.FAIL.getMessage());
    }

    public BusinessException(String message) {
        super(Results.FAIL.getCode(), message);
    }

    public BusinessException(int code, String message) {
        super(code, message);
    }

    public BusinessException(int code, String message, Throwable cause) {
        super(code, message, cause);
    }

    public BusinessException(int code, Throwable cause) {
        super(code, cause);
    }

    public BusinessException(Results rc) {
        super(rc.getCode(), rc.getMessage());
    }
}
